package com.deryun.tyl.bean.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.deryun.tyl.bean.Contact;

public interface ContactMapper {

	@Select({
		"select * from contact"
	})
	List<Contact> getAllContact();
	
	@Insert({
		"INSERT INTO contact (streetName,zoneName,detailAddress,phoneNum) VALUES ("
		+ "#{streetName,jdbcType=VARCHAR},"
		+ "#{zoneName,jdbcType=VARCHAR},"
		+ "#{detailAddress,jdbcType=VARCHAR},"
		+ "#{phoneNum,jdbcType=VARCHAR})"
	})
	int addContact(Contact contact);
	
	@Delete({
		"DELETE FROM contact WHERE id = #{0,jdbcType=INTEGER}"
	})
	int deleteContact(int id);
	
	@Select({
		"SELECT * FROM contact WHERE "
		+ "streetName LIKE #{0,jdbcType=INTEGER} OR "
		+ "zoneName LIKE #{0,jdbcType=INTEGER} OR "
		+ "detailAddress LIKE #{0,jdbcType=INTEGER} OR "
		+ "phoneNum LIKE #{0,jdbcType=INTEGER}"
	})
	List<Contact> searchC(String key);
	
	
}
